# 参考解法
def can_jump(nums):
    farmost = 0
    for i in range(len(nums)):
        if i > farmost:
            return False
        farmost = max(farmost, i+nums[i])
    return True


# 我的解法
def can_jump(nums):
    def __sup(x, step=2):  # step为越过输入的0点所需要最小的步数
        while x >= 0:
            if nums[x] >= step:
                return True
            x -= 1
            step += 1
        return False

    for i in range(len(nums) - 1):
        if nums[i] == 0 and __sup(i - 1) is False:  # __sup辅助函数：判断i（index）之前是否有能够越过i点的值
            return False

    return True
